#include "defs.h"

void memset(void *dst, int c, uint64 n) {
  char *d = (char*)dst;
  for (uint64 i = 0; i < n; i++)
    d[i] = c;
}

void memmove(void *dst, void *src, uint64 n) {
  char *d = (char*)dst;
  char *s = (char*)src;
  if (d < s)
    for (uint64 i = 0; i < n; i++)
      d[i] = s[i];
  else
    for (uint64 i = n - 1; i < n; i--)
      d[i] = s[i];
}

void panic(const char *fmt, ...) {
  printf("panic: ");
  printf(fmt);  // 仅输出字符串，不处理格式参数
  printf("\n");
  while (1);  // 死循环
}